#include "storeorderlistitem.h"
#include "ui_storeorderlistitem.h"
#include "database.h"

StoreOrderListItem::StoreOrderListItem(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::StoreOrderListItem)
{
    ui->setupUi(this);
}

StoreOrderListItem::~StoreOrderListItem()
{
    delete ui;
}
////更新订单项信息
/// orderformnumber 0
/// AccountNumber   1
/// modelnumber		2
/// bargaintime		3
/// assessment		4
/// actuallypaid	5
/// orderstate      6
/// 店铺客服账号      7
void StoreOrderListItem::updateItemInfo(QVector<QString> UserOrderFormList, char i)
{
    Database db;
    QVector<QString> PhoneInfo = db.GetPhoneInfo(UserOrderFormList.at(2 + i*8));
    QString PictureName = "../Phone_platform/sources/picture" + PhoneInfo.at(4) + "001.jpg";

    ui->lb_orderformnumber->setText(UserOrderFormList.at(0 + i*8));
    m_AccountNumber = UserOrderFormList.at(1 + i*8);
    ui->lb_modelnumber->setText(UserOrderFormList.at(2 + i*8));
    ui->lb_bargaintime->setText(UserOrderFormList.at(3 + i*8));
    ui->lb_assessment->setText(UserOrderFormList.at(4 + i*8));
    ui->lb_actuallypaid->setText(UserOrderFormList.at(5 + i*8));
    ui->lb_orderstate->setText(UserOrderFormList.at(6 + i*8));
    ui->lb_picture->setPixmap(QPixmap::fromImage(QImage(PictureName)));
}



///// 发货按钮
void StoreOrderListItem::on_pb_SendGoods_clicked()
{
    if(ui->lE_OrderNumber->text() != "")
    {
        emit SignalSendGoods(ui->lb_orderformnumber->text(),ui->lE_OrderNumber->text());///发送单号
        ui->lE_OrderNumber->setReadOnly(true);
        ui->pb_SendGoods->setEnabled(false);
    }
}
